/**
 * merge level=29
 */

Ext.define('Jfok.report.chart.CategoryCombo', {
	extend : 'Ext.form.field.ComboBox',
	alias : 'widget.reportcategorycombo',

	forceSelection : true,
	editable : false,
	allowBlank : false,
	displayField : 'tf_title',
	valueField : 'tf_fieldName',
	queryMode : 'local',

	initComponent : function() {

		var data = [];
		if (this.grid.isGrouped)
			data.push({
						tf_fieldName : '_total_',
						tf_title : '分组项目'
					})
		Ext.Array.forEach(this.grid.groupAndFields, function(fgroup) {
					Ext.Array.forEach(fgroup.fields, function(field) {

								if (!(field.fieldType == 'Double'
										|| field.fieldType == 'Integer'
										|| field.fieldType == 'Percent' || field.fieldType == 'Float'))
									data.push({
												tf_fieldName : field.dataIndex,
												tf_title : field.text.replace(new RegExp('--', 'gm'),
														'')
											})
							});
				});

		this.store = Ext.create('Ext.data.Store', {
					fields : ['tf_fieldName', 'tf_title'],
					data : data
				});
		if (data.length > 0)
			this.value = data[0].tf_fieldName;
		this.callParent(arguments)
	}

})